home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Format CD 52
/
Amiga Format AFCD52 (Issue 136, May 2000).iso
/
-in_the_mag-
/
javascript
/
part5
/
scripts
/
tip.js
< prev
next >
Wrap
Text File
|
2000-02-07
|
3KB
|
85 lines
<SCRIPT LANGUAGE= "JavaScript1.1">
<!--Cast invisibility spell here
//The Tip Machine is a tip display script that is very
//resistant to problems. Mostly because it is very
//simple. This "low tech" javaScript solution was
//written by Mark Naker (TIMELORDS ANONYMOUS) for
//NERO Colorado. It can be used freely as long as
//this comment block remains.
// Tip Machine version 1.0
//Copyright TIMELORDS ANONYMOUS 1997
function chngNext(){
document.tipMachine.shownext.value = "Y"
tipMach();
}
function chngPrev(){
document.tipMachine.showprev.value = "Y"
tipMach();
}
function tipMach(){
var totalTips = 4; //set total number of tips here
if ((document.tipMachine.shownext.value == "Y") &&
(document.tipMachine.showprev.value == "N")){
var tipShow = (parseInt(document.tipMachine.nowShowing.value) +1);
if (tipShow > totalTips){
var tipShow = 1;}
}
if ((document.tipMachine.showprev.value == "Y") &&
(document.tipMachine.shownext.value == "N")){
var tipShow = (parseInt(document.tipMachine.nowShowing.value) - 1);
if (tipShow < 1){
var tipShow = totalTips;}
}
if ((document.tipMachine.showprev.value == "N") &&
(document.tipMachine.shownext.value == "N")){
var tipShow = (Math.random() * totalTips);
var tipShow = Math.ceil(tipShow);}
//additional tips can be added here just follow the pattern
//remember to use single quotes in the tip text or else bad
//things will happen. Do it this way "text 'more text' text"
if (tipShow == 1) {
var _tip = "Paste this code into your page and jazz up the formatting however you want. Then put in your tips";
}
if (tipShow == 2) {
var _tip = "The script can handle a virtually unlimited number of tips.";
}
if (tipShow == 3) {
var _tip = "The best part about this script is it doesnt reload the page.";
}
if (tipShow == 4) {
var _tip = "Sometimes the low tech 'it doesnt break' solution is the best.";
}
if (tipShow == 5) {
var _tip = "Contact me if you want to know when I update this script or for information about other scripts Ive written.";
}
if (tipShow == 6) {
var _tip = "HTML Goodies page is a good source for scripts when you dont feel like writing them yourself, or dont know how to write them.";
}
if (tipShow == 7) {
var _tip = "You dont have to put tips here you could put any text you want to display like this in here.";
}
if (tipShow == 5) {
var _tip = "The most important thing to remember is DONT PANIC.";
}
document.tipMachine.tipsHere.value = _tip;
document.tipMachine.nowShowing.value = tipShow;
document.tipMachine.ofTotal.value = totalTips;
document.tipMachine.shownext.value = "N";
document.tipMachine.showprev.value = "N";
}
//Dispell invisibility here-->
</SCRIPT>
</head>
<body bgcolor="#FFFFFF">
<center><h2><i>Tip Machine</i></h2>
<FORM NAME="tipMachine" METHOD="post">
<TEXTAREA NAME="tipsHere" ROWS=8 COLS=60 WRAP="virtual" onFocus="this.blur();">Tip Machine javaScript by Mark
Naker.</TEXTAREA><br>
<INPUT TYPE="button" VALUE="RANDOM" onClick="tipMach();">
<INPUT TYPE="button" VALUE="NEXT" onClick="chngNext();"><INPUT TYPE="button" VALUE="PREV" onClick="chngPrev();">
</center><br>
Now showing tip number: <INPUT TYPE="text" SIZE=3 NAME="nowShowing" value="1" onFocus="this.blur();">
of <INPUT TYPE="text" SIZE=3 NAME="ofTotal" onFocus="this.blur();"><br><input type="hidden" name="shownext" value="N"><input type="hidden" name="showprev" value="N">
</FORM>
</center>